# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname=can-utils
pkgver=2020.02.04
pkgrel=0
pkgdesc="SocketCAN userspace utilities and tools"
url="https://github.com/linux-can/can-utils"
arch="all"
license="GPL-2.0-only AND BSD-3-Clause"
options="!check" # package don't have tests
makedepends="cmake linux-headers"
source="$pkgname-$pkgver.tar.gz::https://github.com/linux-can/can-utils/archive/v$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS .
	make -C build
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

sha512sums="5f12a84b82564da5a47e6dc906bf26f0e56db77ce367b5b72a2820cf18447d78a355d0173c678e33dc0e4cc07ef3a12b3a84d6b016c7ee0b1ac5a7f10daee1c8  can-utils-2020.02.04.tar.gz"
